package com.tang.model.v2;

import com.tang.model.domain.Member;

/**
 * @Author tangyuan2meicloud.com
 * @DATE 2021/9/2 20:09
 * @Desc
 * @Remarks
 */
public abstract class Handler {
    protected Handler handler;

    protected void setNextHandle(Handler handler) {
        this.handler = handler;
    }

    public abstract void exec(Member member);

    static class Builder {
        private Handler head;
        private Handler tail;

        public Handler builder() {
            return head;
        }

        public Builder addHandler(Handler handler) {
            if (head == null) {
                head = tail = handler;
                return this;
            }
            tail.setNextHandle(handler);
            tail = handler;
            return this;
        }
    }

}
